import React from "react";
import './App.less';

import {Layout} from 'antd';
import DrawerMenu from "./component/DrawerMenu";
import Header from "./component/Header"
import {Switch, Route} from 'react-router-dom'
import Home from './pages/index'
import User from './pages/user/index'
import Category from './pages/category'
import AddCategory from './pages/category/add'
import Config from './pages/config/index'
import AddConfig from './pages/config/add'

const {Content, Footer} = Layout;

class App extends React.Component {

    state = {
        title: '首页',
        collapsed: false
    }

    render() {
        const {collapsed, title} = this.state
        return (
            <Layout className="App">
                <DrawerMenu collapsed={collapsed} onMenuSelect={(pathname, title) => {
                    this.setState({
                        title
                    })
                }}/>
                <Layout>
                    <Header title={title} toggle={(collapsed) => {
                        this.setState({collapsed})
                    }}/>
                    <Content className='App-content'>
                        <Switch>
                            <Route exact path='/' component={Home}/>
                            <Route path='/category' component={Category}/>
                            <Route path='/add-category' component={AddCategory}/>
                            <Route path='/user' component={User}/>
                            <Route path='/config' component={Config}/>
                            <Route path='/add-config' component={AddConfig}/>
                        </Switch>
                    </Content>
                    <Footer className='App-footer'>
                        AUIU-CLOUD 管理后台 ©2025 Create By
                        <a href='https://www.baidu.com'> 祥少</a>
                    </Footer>
                </Layout>
            </Layout>
        );
    }

}

export default App;
